﻿/**
 * 积分洗mP
 * From:芬芬时尚潮流
 */
var 音符 = "#fEffect/CharacterEff/1032063/0/0#";
var UI0 = "#fEffect/CharacterEff/1051296/1/0#";
var UI1 = "#fEffect/CharacterEff/1051296/1/1#";
var UI2 = "#fEffect/CharacterEff/1051296/1/2#";
var UI3 = "#fEffect/CharacterEff/1051296/1/3#";
var UI4 = "#fEffect/CharacterEff/1051296/1/4#";
var UI5 = "#fEffect/CharacterEff/1051296/1/5#";
var 音符横条 = 音符 + 音符 + 音符 + 音符 + 音符 + 音符 + 音符;
var 蓝星横条 = UI0 + UI1 + UI2 + UI3 + UI4 + UI5 + UI0 + UI1 + UI2 + UI3 + UI4 + UI5 + UI0 + UI1 + UI2 + UI3 + UI4;

var status = 0;

//每点需要的积分
var energy = 30;

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == -1) {
		cm.dispose();
		return;
	} else {
		if (mode == 1) {
			status++;
		} else {
			status--;
		}
		//cm.dispose();
		if (status == 0) {

			cm.sendGetText("" + 音符横条 + "\r\n                #r#e " + cm.getServerName() + "PPMS微积分洗蓝 #d#n#k\r\n\r\n" + 蓝星横条 + "\r\n\r\n\r\n请输入你想洗的数量.1蓝=" + energy + "积分.系统会为您自动计算费用.\r\n您目前的总MP为：#b" + cm.getPlayerStat("MAXMP"));
		} else if (status == 1) {
			var xl = cm.getPlayerStat("MAXMP");
			if (xl == 500000) {
				cm.playerMessage(1, "亲爱的" + cm.getChar().getName() + "\r\n\r\n抱歉！您血量已到最大值\r\n\r\n不能继续增加蓝量了\r\n\r\n蓝量：" + xl);
				cm.dispose();
			} else {
				if (/^[a-zA-Z]*$/.test(cm.getText())) {
					cm.playerMessage(1, "请输入整数数值\r\n\r\n不可包含字母");
					cm.dispose();
				} else if (/^[\u4e00-\u9fa5]*$/.test(cm.getText())) {
					cm.playerMessage(1, "请输入整数数值\r\n\r\n不可包含汉字");
					cm.dispose();
				} else if (cm.getText() < 1) {
					cm.playerMessage(1, "数值不能小于 [1] \r\n\r\n 数值不能大于 [10000] \r\n\r\n请玩家重新调整数值");
					cm.dispose();
				} else if (cm.getText() > 10000) {
					cm.playerMessage(1, "数值不能小于 [1] \r\n\r\n 数值不能大于 [10000] \r\n\r\n请玩家重新调整数值");
					cm.dispose();
				} else {
					cm.sendYesNo("" + 音符横条 + "\r\n                #r#e " + cm.getServerName() + "PPMS微积分洗蓝 #d#n#k\r\n\r\n" + 蓝星横条 + "\r\n\r\n\r\n#r[ #h # ]尊敬的玩家 以下是系统为您计算的费用\r\n\r\n蓝量增#d：" + cm.getText() + "#r\r\n用积分：#d" + cm.getText() * energy + "\r\n\r\n#r　　　　请仔细阅读 无误请单击确认！！");
				}
			}
		} else if (status == 2) {
			var getmaxhp = cm.getChar().getStat().getMaxMp();
			if (cm.getPlayerEnergy() >= cm.getText() * energy) {
				cm.gainPlayerEnergy(-cm.getText() * energy);
				cm.getChar().getStat().gainMaxMp(cm.getText() * 1, cm.getChar());
				cm.worldSpouseMessage(0x15, "[ PPMS微积分洗蓝 ] ：尊敬的玩家" + cm.getChar().getName() + "花费了 " + cm.getText() * energy + " 积分增值了 " + cm.getText() + " 蓝量上限！");
				cm.sendOk("#d#e恭喜您 [ #h # ] 增值了" + cm.getText() + "蓝量！");
				cm.dispose();
			} else {
				cm.sendOk("#d#e抱歉玩家\r\n\r\n您好像没有那么多积分哦！");
				cm.dispose();
			}
		}
	}
}
